#!/bin/bash

# 检查 /tmp 的挂载选项
mount_options=$(mount | grep "/tmp" | awk '{print $6}' | sed 's/(//g; s/)//g' | tr ',' '\n')

required_options=("nosuid" "noexec" "nodev")
missing_options=()

for option in "${required_options[@]}"; do
    if ! echo "$mount_options" | grep -q "$option"; then
        missing_options+=("$option")
    fi
done

if [ ${#missing_options[@]} -eq 0 ]; then
    echo "[PASS] /tmp 分区已配置正确的挂载选项（nosuid,noexec,nodev）。"
else
    echo "[FAIL]/tmp 分区缺少以下挂载选项：${missing_options[*]}。"
    exit 1
fi

